//
//  LYRegisterViewController.m
//  artist
//
//  Created by Jay_Apple on 16/3/13.
//  Copyright © 2016年 viviyoo. All rights reserved.
//

#import "LYRegisterViewController.h"
#import "LYRegister2ViewController.h"
#import "LYProtocolViewController.h"

@interface LYRegisterViewController ()
@property (weak, nonatomic) IBOutlet UITextField *phone;
@property (weak, nonatomic) IBOutlet UIButton *agree;
@property (weak, nonatomic) IBOutlet UILabel *agreeLabel;
@property (weak, nonatomic) IBOutlet UIButton *protocols;

@end

@implementation LYRegisterViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    [self setUpComponent];
}


#pragma mark - 初始化
- (void)setUpComponent{

    if (self.type == viewTypePwd) {
        self.agree.hidden = YES;
        self.agreeLabel.hidden = YES;
        self.protocols.hidden = YES;
        self.navigationItem.title = @"找回密码";
    }else{
        self.navigationItem.title = @"注册";
    }

}

#pragma mark - 按钮点击事件
- (IBAction)registerBtnOnclikc:(id)sender {
    
    if (self.phone.text.length == 0) {
        [MBProgressHUD showError:@"手机不能为空"];
        return;
    }
    if (self.agree.selected) {
        [MBProgressHUD showOnlyText:@"请阅读并同意服务协议"];
        return;
    }
   
        LYRegister2ViewController *vc = [[LYRegister2ViewController alloc] init];
        vc.phoneNum = self.phone.text;
        vc.type = self.type;
        [self.navigationController pushViewController:vc animated:YES];
        
    
}

- (IBAction)agreeBtnOnclick:(UIButton *)sender {
    
    sender.selected = !sender.selected;
}

- (IBAction)protocolOnClick:(id)sender {
    
    LYProtocolViewController *protocolVC = [[LYProtocolViewController alloc] init];
    [self.navigationController pushViewController:protocolVC animated:YES];
    
}





@end
